#include <iostream>
#include <vector>
using namespace std;

class Solution {
public:
    int takeAttendance(vector<int>& records)
    {
        int n = records.size();
        int i = -1;
        for (i = 0; i < n; i++)
        {
            if (records[i] != i)
            {
                return i;
            }
        }
        return i == -1 ? 0 : i;
    }
};

int main()
{
    Solution s;
    vector<int> v = { 0,1,2,3,5 };
    cout << s.takeAttendance(v) << endl;
	return 0;
}